package operation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

public class AddOperation implements Operation {
    @Override
    public void work(BookList bookList) {
        System.out.println("新增图书->");
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入书名->");
        String name = scan.next();
        System.out.println("请输入作者->");
        String author = scan.next();
        System.out.println("请输入价格->");
        int price = scan.nextInt();
        System.out.println("请输入类型->");
        String type = scan.next();
        Book book = new Book(name,author,price,type);
        bookList.setBooks(book,bookList.getUsedSize());
        System.out.println("添加图书成功！");
        bookList.setUsedSize(bookList.getUsedSize()+1);
    }
}
